Skip to content

fix(opencode): normalize file tool argument aliases#29361

Closed
YOMXXX wants to merge 1 commit into
anomalyco:devfrom
YOMXXX:fix/tool-argument-aliases
Closed

fix(opencode): normalize file tool argument aliases#29361
YOMXXX wants to merge 1 commit into
anomalyco:devfrom
YOMXXX:fix/tool-argument-aliases

Conversation

@YOMXXX
Copy link
Copy Markdown

@YOMXXX YOMXXX commented May 26, 2026

Issue for this PR

Closes #29142

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds a narrow tool-execution argument normalization hook before schema decoding, then uses it for write and edit. The public tool JSON schemas stay canonical, but common OpenAI-compatible model aliases like path, file_path, fileContent, old_string, and new_string are mapped back to the expected filePath, content, oldString, and newString keys before validation.

How did you verify your code works?

  • cd packages/opencode && PATH="$HOME/.bun/bin:$PATH" bun test test/tool/write.test.ts --filter "normalizes common model argument aliases"
  • cd packages/opencode && PATH="$HOME/.bun/bin:$PATH" bun test test/tool/edit.test.ts --filter "normalizes common model argument aliases"
  • cd packages/opencode && PATH="$HOME/.bun/bin:$PATH" bun test test/tool/write.test.ts test/tool/edit.test.ts test/tool/tool-define.test.ts test/tool/parameters.test.ts
  • cd packages/opencode && PATH="$HOME/.bun/bin:$PATH" bun typecheck
  • git diff --check
  • PATH="$HOME/.bun/bin:$PATH" .husky/pre-push

Screenshots / recordings

N/A (tool argument handling change).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAI-compatible models can call write/edit with invalid schema arguments

2 participants